package com.wf.apicommons.entity.articleManagement;



import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wf.apicommons.entity.userManagement.UserInformation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @Description: 文章详情
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("t_article_details")
@Document(indexName = "article-management", shards = 5, replicas = 1)
public class ArticleDetails {
    @TableId(value = "id")
    @Id
    private String ID;

    @Field(type = FieldType.Text,analyzer="ik_max_word")
    private String title;

    @Field(type = FieldType.Text,analyzer="ik_max_word")
    private String content;

    @JsonFormat(pattern = "yyyy-MM-dd HH:MM:ss", timezone = "GMT+8")
    @TableField(value="create_time",fill = FieldFill.INSERT)
    @Field(type= FieldType.Date, format= DateFormat.custom, pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:MM:ss", timezone = "GMT+8")
    @TableField(value="update_time",fill = FieldFill.INSERT_UPDATE)
    @Field(type= FieldType.Date, format= DateFormat.custom, pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Field(type = FieldType.Integer)
    private Integer status;

    @Field(type = FieldType.Nested)
    private UserInformation userInformationId;
}
